<template>
  <div class="my-container">
    <el-row>
      <el-col :span="6">
        <ProjectCard class="user-card" :features="featureData"></ProjectCard>
      </el-col>
      <el-col :span="18">
        <el-card>
          <el-tabs v-model="activeName">
            <el-tab-pane :label="$t('message.profile.feature')" name="feature">
              <feature :features="featureData" />
            </el-tab-pane>
            <el-tab-pane :label="$t('message.profile.chapter')" name="chapter">
              <Chapters />
            </el-tab-pane>
            <el-tab-pane :label="$t('message.profile.author')" name="author">
              <Authors />
            </el-tab-pane>
          </el-tabs>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import ProjectCard from './components/ProjectCard.vue'
import feature from './components/feature.vue'
// eslint-disable-next-line
import Authors from './components/authors.vue'
import Chapters from './components/chapter.vue'

import { features } from '@/api/user'

import { watchLangChange } from '@/utils/i18n'
const featureData = ref([])
const activeName = ref('feature')
const getFeatures = async () => {
  featureData.value = await features()
}
getFeatures()
watchLangChange(() => {
  getFeatures()
})
</script>

<style lang="scss" scoped>
.my-container {
  .user-card {
    margin-right: 20px;
  }
}
</style>
